package com.quzhi.config;

import com.quzhi.sys.interceptor.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Arrays;
import java.util.List;

@Configuration
public class MyWebMvcConfig implements WebMvcConfigurer {
    private static List<String> excluePathList = Arrays.asList(
            "/sys/user/login",
            "/sys/user/info",
            "/sys/user/logout",
            "/sys/order/exportSendOrder",
            "/sys/order/export",
            "/sys/order/exportSerialNumber",
            "/sys/order/import",
            "/sys/order/importOrderAndSerialNumber",
            "/sys/common/upload",
            "/sys/common/download",
            "/sys/common/deleteFile",
            "/sys/inventory/getAllProductDangQi"
    );

    @Autowired
    private LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor).addPathPatterns("/**").
                excludePathPatterns(excluePathList);
    }


}
